home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Apple Game Sprockets / InputSprocket 1.4 SDK / Interfaces&Libraries / InputSprocket.h next >
Encoding:
C/C++ Source or Header  |  1998-11-30  |  28.1 KB  |  998 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        InputSprocket.h
  3.  
  4.      Contains:    Games Sprockets: InputSprocket interfaaces
  5.  
  6.      Version:    Technology:    InputSprocket 1.4
  7.                  Release:    InputSprocket SDK, Use 3.2 Universal Headers
  8.  
  9.      Copyright:    © 1996-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __INPUTSPROCKET__
  18. #define __INPUTSPROCKET__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __EVENTS__
  24. #include <Events.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=power
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49. #ifndef USE_OLD_INPUT_SPROCKET_LABELS
  50. #define USE_OLD_INPUT_SPROCKET_LABELS 0
  51. #endif  /* !defined(USE_OLD_INPUT_SPROCKET_LABELS) */
  52.  
  53. #ifndef USE_OLD_ISPNEED_STRUCT
  54. #define USE_OLD_ISPNEED_STRUCT 0
  55. #endif  /* !defined(USE_OLD_ISPNEED_STRUCT) */
  56.  
  57. /* ********************* data types ********************* */
  58. typedef struct OpaqueISpDeviceReference*  ISpDeviceReference;
  59. typedef struct OpaqueISpElementReference*  ISpElementReference;
  60. typedef struct OpaqueISpElementListReference*  ISpElementListReference;
  61. /* ISpDeviceClass is a general classs of device, example: keyboard, mouse, joystick */
  62. typedef OSType                             ISpDeviceClass;
  63. /* ISpDeviceIdentifier is a specific device,  example: standard 1-button mouse, 105key ext. kbd. */
  64. typedef OSType                             ISpDeviceIdentifier;
  65. typedef OSType                             ISpElementLabel;
  66. typedef OSType                             ISpElementKind;
  67.  
  68. /* *************** errors -30420 to -30439***************** */
  69.  
  70. enum {
  71.     kISpInternalErr                = -30420,
  72.     kISpSystemListErr            = -30421,
  73.     kISpBufferToSmallErr        = -30422,
  74.     kISpElementInListErr        = -30423,
  75.     kISpElementNotInListErr        = -30424,
  76.     kISpSystemInactiveErr        = -30425,
  77.     kISpDeviceInactiveErr        = -30426,
  78.     kISpSystemActiveErr            = -30427,
  79.     kISpDeviceActiveErr            = -30428,
  80.     kISpListBusyErr                = -30429
  81. };
  82.  
  83. /* *************** resources **************** */
  84.  
  85. enum {
  86.     kISpApplicationResourceType    = FOUR_CHAR_CODE('isap'),
  87.     kISpSetListResourceType        = FOUR_CHAR_CODE('setl'),
  88.     kISpSetDataResourceType        = FOUR_CHAR_CODE('setd')
  89. };
  90.  
  91.  
  92. struct ISpApplicationResourceStruct {
  93.     UInt32                             flags;
  94.     UInt32                             reserved1;
  95.     UInt32                             reserved2;
  96.     UInt32                             reserved3;
  97. };
  98. typedef struct ISpApplicationResourceStruct ISpApplicationResourceStruct;
  99.  
  100. enum {
  101.     kISpAppResFlag_UsesInputSprocket = 0x00000001,                /* true if the application uses InputSprocket*/
  102.     kISpAppResFlag_UsesISpInit    = 0x00000002                    /* true if the calls ISpInit (ie, uses the high level interface, calls ISpConfigure, has a needs list, etc...)*/
  103. };
  104.  
  105. /*
  106.  * ISpDeviceDefinition
  107.  *
  108.  * This structure provides all the available
  109.  * information for an input device within the system
  110.  *
  111.  */
  112.  
  113. struct ISpDeviceDefinition {
  114.     Str63                             deviceName;                    /* a human readable name of the device */
  115.     ISpDeviceClass                     theDeviceClass;                /* general classs of device example : keyboard, mouse, joystick */
  116.     ISpDeviceIdentifier             theDeviceIdentifier;        /* every distinguishable device should have an OSType */
  117.     UInt32                             permanentID;                /* a cross reboot id unique within that deviceType, 0 if not possible */
  118.     UInt32                             flags;                        /* status flags */
  119.     UInt32                             reserved1;
  120.     UInt32                             reserved2;
  121.     UInt32                             reserved3;
  122. };
  123. typedef struct ISpDeviceDefinition        ISpDeviceDefinition;
  124.  
  125. enum {
  126.     kISpDeviceFlag_HandleOwnEmulation = 1
  127. };
  128.  
  129. /*
  130.  * ISpElementEvent, ISpElementEventPtr
  131.  *
  132.  * This is the structure that event data is passed in.
  133.  *
  134.  */
  135.  
  136. struct ISpElementEvent {
  137.     AbsoluteTime                     when;                        /* this is absolute time on PCI or later, otherwise it is */
  138.                                                                 /* 0 for the hi 32 bits and TickCount for the low 32 bits */
  139.     ISpElementReference             element;                    /* a reference to the element that generated this event */
  140.     UInt32                             refCon;                        /* for application usage, 0 on the global list */
  141.     UInt32                             data;                        /* the data for this event */
  142. };
  143. typedef struct ISpElementEvent            ISpElementEvent;
  144. typedef ISpElementEvent *                ISpElementEventPtr;
  145. /*
  146.  * ISpElementInfo, ISpElementInfoPtr
  147.  *
  148.  * This is the generic definition of an element.
  149.  * Every element must contain this information.
  150.  *
  151.  */
  152.  
  153. struct ISpElementInfo {
  154.     ISpElementLabel                 theLabel;
  155.     ISpElementKind                     theKind;
  156.     Str63                             theString;
  157.     UInt32                             reserved1;
  158.     UInt32                             reserved2;
  159. };
  160. typedef struct ISpElementInfo            ISpElementInfo;
  161. typedef ISpElementInfo *                ISpElementInfoPtr;
  162.  
  163. typedef UInt32                             ISpNeedFlagBits;
  164. #if USE_OLD_ISPNEED_STRUCT
  165.  
  166. struct ISpNeed {
  167.     Str63                             name;
  168.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  169.     short                             reserved;
  170.     ISpElementKind                     theKind;
  171.     ISpElementLabel                 theLabel;
  172.     ISpNeedFlagBits                 flags;
  173.     UInt32                             reserved1;
  174.     UInt32                             reserved2;
  175.     UInt32                             reserved3;
  176. };
  177. typedef struct ISpNeed                    ISpNeed;
  178. #else
  179.  
  180. struct ISpNeed {
  181.     Str63                             name;                        /* human-readable string */
  182.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  183.     UInt8                             playerNum;                    /* used for multi-player support */
  184.     UInt8                             group;                        /* used to group related needs (eg, look left and look right button needs) */
  185.     ISpElementKind                     theKind;
  186.     ISpElementLabel                 theLabel;
  187.     ISpNeedFlagBits                 flags;
  188.     UInt32                             reserved1;
  189.     UInt32                             reserved2;
  190.     UInt32                             reserved3;
  191. };
  192. typedef struct ISpNeed                    ISpNeed;
  193. #endif  /* USE_OLD_ISPNEED_STRUCT */
  194.  
  195.  
  196. enum {
  197.     kISpNeedFlag_NoMultiConfig    = 0x00000001,                    /* once this need is autoconfigured to one device dont autoconfigure to anything else*/
  198.     kISpNeedFlag_Utility        = 0x00000002,                    /* this need is a utility function (like show framerate) which would not typically be assigned to anything but the keyboard*/
  199.     kISpNeedFlag_PolledOnly        = 0x00000004,
  200.     kISpNeedFlag_EventsOnly        = 0x00000008,                    /* *** kISpElementKind specific flags ****/
  201.                                                                 /* these are flags specific to kISpElementKind_Button*/
  202.     kISpNeedFlag_Button_AlreadyAxis = 0x10000000,                /* there is a axis version of this button need*/
  203.     kISpNeedFlag_Button_ClickToggles = 0x20000000,
  204.     kISpNeedFlag_Button_ActiveWhenDown = 0x40000000,
  205.     kISpNeedFlag_Button_AlreadyDelta = (long)0x80000000,        /* there is a delta version of this button need*/
  206.                                                                 /* these are flags specific to kISpElementKind_DPad*/
  207.                                                                 /* these are flags specific to kISpElementKind_Axis*/
  208.     kISpNeedFlag_Axis_AlreadyButton = 0x10000000,                /* there is a button version of this axis need*/
  209.     kISpNeedFlag_Axis_Asymetric    = 0x20000000,                    /* this axis need is asymetric    */
  210.     kISpNeedFlag_Axis_AlreadyDelta = 0x40000000,                /* there is a delta version of this axis need*/
  211.                                                                 /* these are flags specific to kISpElementKind_Delta*/
  212.     kISpNeedFlag_Delta_AlreadyAxis = 0x10000000,                /* there is a axis version of this delta need*/
  213.     kISpNeedFlag_Delta_AlreadyButton = 0x20000000                /* there is a button version of this delta need*/
  214. };
  215.  
  216. /*
  217.  *
  218.  * These are the current built values for ISpDeviceClass
  219.  *
  220.  */
  221.  
  222. enum {
  223.     kISpDeviceClass_SpeechRecognition = FOUR_CHAR_CODE('talk'),
  224.     kISpDeviceClass_Mouse        = FOUR_CHAR_CODE('mous'),
  225.     kISpDeviceClass_Keyboard    = FOUR_CHAR_CODE('keyd'),
  226.     kISpDeviceClass_Joystick    = FOUR_CHAR_CODE('joys'),
  227.     kISpDeviceClass_Wheel        = FOUR_CHAR_CODE('whel'),
  228.     kISpDeviceClass_Pedals        = FOUR_CHAR_CODE('pedl'),
  229.     kISpDeviceClass_Levers        = FOUR_CHAR_CODE('levr'),
  230.     kISpDeviceClass_Tickle        = FOUR_CHAR_CODE('tckl'),        /* a device of this class requires ISpTickle*/
  231.     kISpDeviceClass_Unknown        = FOUR_CHAR_CODE('????')
  232. };
  233.  
  234. /*
  235.  * These are the current built in ISpElementKind's
  236.  * 
  237.  * These are all OSTypes.
  238.  *
  239.  */
  240.  
  241. enum {
  242.     kISpElementKind_Button        = FOUR_CHAR_CODE('butn'),
  243.     kISpElementKind_DPad        = FOUR_CHAR_CODE('dpad'),
  244.     kISpElementKind_Axis        = FOUR_CHAR_CODE('axis'),
  245.     kISpElementKind_Delta        = FOUR_CHAR_CODE('dlta'),
  246.     kISpElementKind_Movement    = FOUR_CHAR_CODE('move'),
  247.     kISpElementKind_Virtual        = FOUR_CHAR_CODE('virt')
  248. };
  249.  
  250.  
  251. /*
  252.  *
  253.  * These are the current built in ISpElementLabel's
  254.  *
  255.  * These are all OSTypes.
  256.  *
  257.  */
  258. #if USE_OLD_INPUT_SPROCKET_LABELS
  259.  
  260. enum {
  261.                                                                 /* axis */
  262.     kISpElementLabel_XAxis        = FOUR_CHAR_CODE('xaxi'),
  263.     kISpElementLabel_YAxis        = FOUR_CHAR_CODE('yaxi'),
  264.     kISpElementLabel_ZAxis        = FOUR_CHAR_CODE('zaxi'),
  265.     kISpElementLabel_Rx            = FOUR_CHAR_CODE('rxax'),
  266.     kISpElementLabel_Ry            = FOUR_CHAR_CODE('ryax'),
  267.     kISpElementLabel_Rz            = FOUR_CHAR_CODE('rzax'),
  268.     kISpElementLabel_Gas        = FOUR_CHAR_CODE('gasp'),
  269.     kISpElementLabel_Brake        = FOUR_CHAR_CODE('brak'),
  270.     kISpElementLabel_Clutch        = FOUR_CHAR_CODE('cltc'),
  271.     kISpElementLabel_Throttle    = FOUR_CHAR_CODE('thrt'),
  272.     kISpElementLabel_Trim        = FOUR_CHAR_CODE('trim'),        /* direction pad */
  273.     kISpElementLabel_POVHat        = FOUR_CHAR_CODE('povh'),
  274.     kISpElementLabel_PadMove    = FOUR_CHAR_CODE('move'),        /* buttons */
  275.     kISpElementLabel_Fire        = FOUR_CHAR_CODE('fire'),
  276.     kISpElementLabel_Start        = FOUR_CHAR_CODE('strt'),
  277.     kISpElementLabel_Select        = FOUR_CHAR_CODE('optn'),        /* Pause/Resume was changed into 2 needs: Quit and start/pause */
  278.     kISpElementLabel_Btn_PauseResume = FOUR_CHAR_CODE('strt')
  279. };
  280.  
  281. #endif  /* USE_OLD_INPUT_SPROCKET_LABELS */
  282.  
  283.  
  284. enum {
  285.                                                                 /* generic */
  286.     kISpElementLabel_None        = FOUR_CHAR_CODE('none'),        /* axis */
  287.     kISpElementLabel_Axis_XAxis    = FOUR_CHAR_CODE('xaxi'),
  288.     kISpElementLabel_Axis_YAxis    = FOUR_CHAR_CODE('yaxi'),
  289.     kISpElementLabel_Axis_ZAxis    = FOUR_CHAR_CODE('zaxi'),
  290.     kISpElementLabel_Axis_Rx    = FOUR_CHAR_CODE('rxax'),
  291.     kISpElementLabel_Axis_Ry    = FOUR_CHAR_CODE('ryax'),
  292.     kISpElementLabel_Axis_Rz    = FOUR_CHAR_CODE('rzax'),
  293.     kISpElementLabel_Axis_Roll    = kISpElementLabel_Axis_Rz,
  294.     kISpElementLabel_Axis_Pitch    = kISpElementLabel_Axis_Rx,
  295.     kISpElementLabel_Axis_Yaw    = kISpElementLabel_Axis_Ry,
  296.     kISpElementLabel_Axis_RollTrim = FOUR_CHAR_CODE('rxtm'),
  297.     kISpElementLabel_Axis_PitchTrim = FOUR_CHAR_CODE('trim'),
  298.     kISpElementLabel_Axis_YawTrim = FOUR_CHAR_CODE('rytm'),
  299.     kISpElementLabel_Axis_Gas    = FOUR_CHAR_CODE('gasp'),
  300.     kISpElementLabel_Axis_Brake    = FOUR_CHAR_CODE('brak'),
  301.     kISpElementLabel_Axis_Clutch = FOUR_CHAR_CODE('cltc'),
  302.     kISpElementLabel_Axis_Throttle = FOUR_CHAR_CODE('thrt'),
  303.     kISpElementLabel_Axis_Trim    = kISpElementLabel_Axis_PitchTrim,
  304.     kISpElementLabel_Axis_Rudder = FOUR_CHAR_CODE('rudd'),        /* delta */
  305.     kISpElementLabel_Delta_X    = FOUR_CHAR_CODE('xdlt'),
  306.     kISpElementLabel_Delta_Y    = FOUR_CHAR_CODE('ydlt'),
  307.     kISpElementLabel_Delta_Z    = FOUR_CHAR_CODE('zdlt'),
  308.     kISpElementLabel_Delta_Rx    = FOUR_CHAR_CODE('rxdl'),
  309.     kISpElementLabel_Delta_Ry    = FOUR_CHAR_CODE('rydl'),
  310.     kISpElementLabel_Delta_Rz    = FOUR_CHAR_CODE('rzdl'),
  311.     kISpElementLabel_Delta_Roll    = kISpElementLabel_Delta_Rz,
  312.     kISpElementLabel_Delta_Pitch = kISpElementLabel_Delta_Rx,
  313.     kISpElementLabel_Delta_Yaw    = kISpElementLabel_Delta_Ry,    /* direction pad */
  314.     kISpElementLabel_Pad_POV    = FOUR_CHAR_CODE('povh'),        /* up/down/left/right*/
  315.     kISpElementLabel_Pad_Move    = FOUR_CHAR_CODE('move'),        /* up/down/left/right*/
  316.     kISpElementLabel_Pad_POV_Horiz = FOUR_CHAR_CODE('hpov'),    /* forward/back/left/right*/
  317.     kISpElementLabel_Pad_Move_Horiz = FOUR_CHAR_CODE('hmov'),    /* forward/back/left/right*/
  318.                                                                 /* buttons */
  319.     kISpElementLabel_Btn_Fire    = FOUR_CHAR_CODE('fire'),
  320.     kISpElementLabel_Btn_SecondaryFire = FOUR_CHAR_CODE('sfir'),
  321.     kISpElementLabel_Btn_Jump    = FOUR_CHAR_CODE('jump'),
  322.     kISpElementLabel_Btn_Quit    = FOUR_CHAR_CODE('strt'),        /* kISpElementLabel_Btn_Quit automatically binds to escape */
  323.     kISpElementLabel_Btn_StartPause = FOUR_CHAR_CODE('paus'),
  324.     kISpElementLabel_Btn_Select    = FOUR_CHAR_CODE('optn'),
  325.     kISpElementLabel_Btn_SlideLeft = FOUR_CHAR_CODE('blft'),
  326.     kISpElementLabel_Btn_SlideRight = FOUR_CHAR_CODE('brgt'),
  327.     kISpElementLabel_Btn_MoveForward = FOUR_CHAR_CODE('btmf'),
  328.     kISpElementLabel_Btn_MoveBackward = FOUR_CHAR_CODE('btmb'),
  329.     kISpElementLabel_Btn_TurnLeft = FOUR_CHAR_CODE('bttl'),
  330.     kISpElementLabel_Btn_TurnRight = FOUR_CHAR_CODE('bttr'),
  331.     kISpElementLabel_Btn_LookLeft = FOUR_CHAR_CODE('btll'),
  332.     kISpElementLabel_Btn_LookRight = FOUR_CHAR_CODE('btlr'),
  333.     kISpElementLabel_Btn_LookUp    = FOUR_CHAR_CODE('btlu'),
  334.     kISpElementLabel_Btn_LookDown = FOUR_CHAR_CODE('btld'),
  335.     kISpElementLabel_Btn_Next    = FOUR_CHAR_CODE('btnx'),
  336.     kISpElementLabel_Btn_Previous = FOUR_CHAR_CODE('btpv'),
  337.     kISpElementLabel_Btn_SideStep = FOUR_CHAR_CODE('side'),
  338.     kISpElementLabel_Btn_Run    = FOUR_CHAR_CODE('quik'),
  339.     kISpElementLabel_Btn_Look    = FOUR_CHAR_CODE('blok')
  340. };
  341.  
  342. /*
  343.  *
  344.  * direction pad data & configuration information
  345.  *
  346.  */
  347.  
  348. typedef UInt32                             ISpDPadData;
  349.  
  350. enum {
  351.     kISpPadIdle                    = 0,
  352.     kISpPadLeft                    = 1,
  353.     kISpPadUpLeft                = 2,
  354.     kISpPadUp                    = 3,
  355.     kISpPadUpRight                = 4,
  356.     kISpPadRight                = 5,
  357.     kISpPadDownRight            = 6,
  358.     kISpPadDown                    = 7,
  359.     kISpPadDownLeft                = 8
  360. };
  361.  
  362.  
  363. struct ISpDPadConfigurationInfo {
  364.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of direction pads */
  365.     Boolean                         fourWayPad;                    /* true if this pad can only produce idle + four directions */
  366. };
  367. typedef struct ISpDPadConfigurationInfo    ISpDPadConfigurationInfo;
  368. /*
  369.  *
  370.  * button data & configuration information
  371.  *
  372.  */
  373.  
  374. typedef UInt32                             ISpButtonData;
  375.  
  376. enum {
  377.     kISpButtonUp                = 0,
  378.     kISpButtonDown                = 1
  379. };
  380.  
  381.  
  382. struct ISpButtonConfigurationInfo {
  383.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of buttons */
  384. };
  385. typedef struct ISpButtonConfigurationInfo ISpButtonConfigurationInfo;
  386. /*
  387.  *
  388.  * axis data & configuration information 
  389.  *
  390.  */
  391.  
  392. typedef UInt32                             ISpAxisData;
  393.  
  394. #define    kISpAxisMinimum  0x00000000U
  395. #define    kISpAxisMiddle   0x7FFFFFFFU
  396. #define    kISpAxisMaximum  0xFFFFFFFFU
  397.  
  398.  
  399. struct ISpAxisConfigurationInfo {
  400.     Boolean                         symetricAxis;                /* axis is symetric, i.e. a joystick is symetric and a gas pedal is not */
  401. };
  402. typedef struct ISpAxisConfigurationInfo    ISpAxisConfigurationInfo;
  403.  
  404. typedef Fixed                             ISpDeltaData;
  405.  
  406. struct ISpDeltaConfigurationInfo {
  407.     UInt32                             reserved1;
  408.     UInt32                             reserved2;
  409. };
  410. typedef struct ISpDeltaConfigurationInfo ISpDeltaConfigurationInfo;
  411.  
  412. struct ISpMovementData {
  413.     ISpAxisData                     xAxis;
  414.     ISpAxisData                     yAxis;
  415.     ISpDPadData                     direction;                    /* ISpDPadData version of the movement */
  416. };
  417. typedef struct ISpMovementData            ISpMovementData;
  418.  
  419. struct ISpMovementConfigurationInfo {
  420.     UInt32                             reserved1;
  421.     UInt32                             reserved2;
  422. };
  423. typedef struct ISpMovementConfigurationInfo ISpMovementConfigurationInfo;
  424.  
  425. enum {
  426.     kISpVirtualElementFlag_UseTempMem = 1
  427. };
  428.  
  429.  
  430. enum {
  431.     kISpElementListFlag_UseTempMem = 1
  432. };
  433.  
  434.  
  435. enum {
  436.     kISpFirstIconSuite            = 30000,
  437.     kISpLastIconSuite            = 30100,
  438.     kISpNoneIconSuite            = 30000
  439. };
  440.  
  441.  
  442. #if TARGET_RT_MAC_CFM
  443. /* ********************* user level functions ********************* */
  444. /*
  445.  *
  446.  * startup / shutdown
  447.  *
  448.  */
  449. EXTERN_API_C( OSStatus )
  450. ISpStartup                        (void);
  451.  
  452. /* 1.1 or later*/
  453. EXTERN_API_C( OSStatus )
  454. ISpShutdown                        (void);
  455.  
  456. /* 1.1 or later*/
  457. /*
  458.  *
  459.  * polling
  460.  *
  461.  */
  462. EXTERN_API_C( OSStatus )
  463. ISpTickle                        (void);
  464.  
  465. /* 1.1 or later*/
  466. /********** user interface functions **********/
  467.  
  468. EXTERN_API_C( NumVersion )
  469. ISpGetVersion                    (void);
  470.  
  471. /*
  472.  *
  473.  * ISpElement_NewVirtual(ISpElementReference *outElement);
  474.  *
  475.  */
  476. EXTERN_API_C( OSStatus )
  477. ISpElement_NewVirtual            (UInt32                 dataSize,
  478.                                  ISpElementReference *    outElement,
  479.                                  UInt32                 flags);
  480.  
  481. /*
  482.  *
  483.  * ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeeds *needs, ISpElementReference *outElements);
  484.  *
  485.  */
  486. EXTERN_API_C( OSStatus )
  487. ISpElement_NewVirtualFromNeeds    (UInt32                 count,
  488.                                  ISpNeed *                needs,
  489.                                  ISpElementReference *    outElements,
  490.                                  UInt32                 flags);
  491.  
  492. /*
  493.  *
  494.  * ISpElement_DisposeVirtual(inElement);
  495.  *
  496.  */
  497. EXTERN_API_C( OSStatus )
  498. ISpElement_DisposeVirtual        (UInt32                 count,
  499.                                  ISpElementReference *    inElements);
  500.  
  501. /*
  502.  * ISpInit
  503.  *
  504.  */
  505. EXTERN_API_C( OSStatus )
  506. ISpInit                            (UInt32                 count,
  507.                                  ISpNeed *                needs,
  508.                                  ISpElementReference *    inReferences,
  509.                                  OSType                 appCreatorCode,
  510.                                  OSType                 subCreatorCode,
  511.                                  UInt32                 flags,
  512.                                  short                     setListResourceId,
  513.                                  UInt32                 reserved);
  514.  
  515.  
  516. /*
  517.  * ISpConfigure
  518.  *
  519.  */
  520. typedef CALLBACK_API_C( Boolean , ISpEventProcPtr )(EventRecord *inEvent);
  521. EXTERN_API_C( OSStatus )
  522. ISpConfigure                    (ISpEventProcPtr         inEventProcPtr);
  523.  
  524. /*
  525.  *
  526.  * ISpStop
  527.  *
  528.  */
  529. EXTERN_API_C( OSStatus )
  530. ISpStop                            (void);
  531.  
  532. /*
  533.  *
  534.  * ISpSuspend, ISpResume
  535.  *
  536.  * ISpSuspend turns all devices off and allocates memory so that the state may be later resumed.
  537.  * ISpResume resumes to the previous state of the system after a suspend call.
  538.  * 
  539.  * Return Codes
  540.  * memFullErr
  541.  *
  542.  */
  543. EXTERN_API_C( OSStatus )
  544. ISpSuspend                        (void);
  545.  
  546. EXTERN_API_C( OSStatus )
  547. ISpResume                        (void);
  548.  
  549. /*
  550.  * ISpDevices_Extract, ISpDevices_ExtractByClass, ISpDevices_ExtractByIdentifier
  551.  *
  552.  * These will extract as many device references from the system wide list as will fit in your buffer.  
  553.  *
  554.  * inBufferCount - the size of your buffer (in units of sizeof(ISpDeviceReference)) this may be zero
  555.  * buffer - a pointer to your buffer
  556.  * outCount - contains the number of devices in the system
  557.  *
  558.  * ISpDevices_ExtractByClass extracts and counts devices of the specified ISpDeviceClass
  559.  * ISpDevices_ExtractByIdentifier extracts and counts devices of the specified ISpDeviceIdentifier
  560.  *
  561.  * Return Codes
  562.  * paramErr
  563.  *
  564.  */
  565. EXTERN_API_C( OSStatus )
  566. ISpDevices_Extract                (UInt32                 inBufferCount,
  567.                                  UInt32 *                outCount,
  568.                                  ISpDeviceReference *    buffer);
  569.  
  570. EXTERN_API_C( OSStatus )
  571. ISpDevices_ExtractByClass        (ISpDeviceClass         inClass,
  572.                                  UInt32                 inBufferCount,
  573.                                  UInt32 *                outCount,
  574.                                  ISpDeviceReference *    buffer);
  575.  
  576. EXTERN_API_C( OSStatus )
  577. ISpDevices_ExtractByIdentifier    (ISpDeviceIdentifier     inIdentifier,
  578.                                  UInt32                 inBufferCount,
  579.                                  UInt32 *                outCount,
  580.                                  ISpDeviceReference *    buffer);
  581.  
  582.  
  583. /*
  584.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass, ISpDevices_Activate, ISpDevices_Deactivate, ISpDevice_IsActive
  585.  *
  586.  * ISpDevices_Activate, ISpDevices_Deactivate
  587.  *
  588.  * This will activate/deactivate a block of devices.
  589.  * inDeviceCount - the number of devices to activate / deactivate
  590.  * inDevicesToActivate/inDevicesToDeactivate - a pointer to a block of memory contains the devices references
  591.  *
  592.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass
  593.  * inClass - the class of devices to activate or deactivate
  594.  *
  595.  * ISpDevice_IsActive
  596.  * inDevice - the device reference that you wish to 
  597.  * outIsActive - a boolean value that is true when the device is active
  598.  *
  599.  * Return Codes
  600.  * paramErr
  601.  *
  602.  */
  603. EXTERN_API_C( OSStatus )
  604. ISpDevices_ActivateClass        (ISpDeviceClass         inClass);
  605.  
  606. /* 1.1 or later*/
  607. EXTERN_API_C( OSStatus )
  608. ISpDevices_DeactivateClass        (ISpDeviceClass         inClass);
  609.  
  610. /* 1.1 or later*/
  611. EXTERN_API_C( OSStatus )
  612. ISpDevices_Activate                (UInt32                 inDeviceCount,
  613.                                  ISpDeviceReference *    inDevicesToActivate);
  614.  
  615. EXTERN_API_C( OSStatus )
  616. ISpDevices_Deactivate            (UInt32                 inDeviceCount,
  617.                                  ISpDeviceReference *    inDevicesToDeactivate);
  618.  
  619. EXTERN_API_C( OSStatus )
  620. ISpDevice_IsActive                (ISpDeviceReference     inDevice,
  621.                                  Boolean *                outIsActive);
  622.  
  623. /*
  624.  * ISpDevice_GetDefinition
  625.  *
  626.  *
  627.  * inDevice - the device you want to get the definition for
  628.  * inBuflen - the size of the structure (sizeof(ISpDeviceDefinition))
  629.  * outStruct - a pointer to where you want the structure copied
  630.  *
  631.  * Return Codes
  632.  * paramErr
  633.  *
  634.  */
  635. EXTERN_API_C( OSStatus )
  636. ISpDevice_GetDefinition            (ISpDeviceReference     inDevice,
  637.                                  UInt32                 inBuflen,
  638.                                  ISpDeviceDefinition *    outStruct);
  639.  
  640.  
  641. /*
  642.  *
  643.  * ISpDevice_GetElementList
  644.  *
  645.  * inDevice - the device whose element list you wish to get
  646.  * outElementList - a pointer to where you want a reference to that list stored
  647.  *
  648.  * Return Codes
  649.  * paramErr
  650.  *
  651.  */
  652. EXTERN_API_C( OSStatus )
  653. ISpDevice_GetElementList        (ISpDeviceReference     inDevice,
  654.                                  ISpElementListReference * outElementList);
  655.  
  656. /*
  657.  *
  658.  * takes an ISpElementReference and returns the group that it is in or 0 if there is
  659.  * no group
  660.  *
  661.  * Return Codes
  662.  * paramErr
  663.  *
  664.  */
  665. EXTERN_API_C( OSStatus )
  666. ISpElement_GetGroup                (ISpElementReference     inElement,
  667.                                  UInt32 *                outGroup);
  668.  
  669. /*
  670.  *
  671.  * takes an ISpElementReference and returns the device that the element belongs 
  672.  * to.
  673.  *
  674.  * Return Codes
  675.  * paramErr if inElement is 0 or outDevice is nil
  676.  *
  677.  */
  678. EXTERN_API_C( OSStatus )
  679. ISpElement_GetDevice            (ISpElementReference     inElement,
  680.                                  ISpDeviceReference *    outDevice);
  681.  
  682. /*
  683.  *
  684.  * takes an ISpElementReference and gives the ISpElementInfo for that Element.  This is the
  685.  * the set of standard information.  You get ISpElementKind specific information
  686.  * through ISpElement_GetConfigurationInfo.
  687.  *
  688.  * Return Codes
  689.  * paramErr if inElement is 0 or outInfo is nil
  690.  *
  691.  */
  692. EXTERN_API_C( OSStatus )
  693. ISpElement_GetInfo                (ISpElementReference     inElement,
  694.                                  ISpElementInfoPtr         outInfo);
  695.  
  696. /*
  697.  *
  698.  *         
  699.  *
  700.  * takes an ISpElementReference and gives the ISpElementKind specific configuration information
  701.  * 
  702.  * if buflen is not long enough to hold the information ISpElement_GetConfigurationInfo will
  703.  * copy buflen bytes of the data into the block of memory pointed to by configInfo and
  704.  * will return something error.
  705.  *
  706.  * Return Codes
  707.  * paramErr if inElement or configInfo is nil
  708.  *
  709.  */
  710. EXTERN_API_C( OSStatus )
  711. ISpElement_GetConfigurationInfo    (ISpElementReference     inElement,
  712.                                  UInt32                 buflen,
  713.                                  void *                    configInfo);
  714.  
  715. /*
  716.  *
  717.  * ISpElement_GetSimpleState
  718.  *
  719.  * Takes an ISpElementReference and returns the current state of that element.  This is a 
  720.  * specialized version of ISpElement_GetComplexState that is only appropriate for elements
  721.  * whose data fits in a signed 32 bit integer.
  722.  *
  723.  *
  724.  *
  725.  * Return Codes
  726.  * paramErr if inElement is 0 or state is nil
  727.  *
  728.  */
  729. EXTERN_API_C( OSStatus )
  730. ISpElement_GetSimpleState        (ISpElementReference     inElement,
  731.                                  UInt32 *                state);
  732.  
  733. /*
  734.  *
  735.  * ISpElement_GetComplexState
  736.  *
  737.  * Takes an ISpElementReference and returns the current state of that element.  
  738.  * Will copy up to buflen bytes of the current state of the device into
  739.  * state.
  740.  *
  741.  *
  742.  * Return Codes
  743.  * paramErr if inElement is 0 or state is nil
  744.  *
  745.  */
  746. EXTERN_API_C( OSStatus )
  747. ISpElement_GetComplexState        (ISpElementReference     inElement,
  748.                                  UInt32                 buflen,
  749.                                  void *                    state);
  750.  
  751.  
  752. /*
  753.  * ISpElement_GetNextEvent
  754.  *
  755.  * It takes in an element  reference and the buffer size of the ISpElementEventPtr
  756.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  757.  * was not enough space to fill in the whole event structure that event will be
  758.  * dequed, as much of the event as will fit in the buffer will by copied and
  759.  * ISpElement_GetNextEvent will return an error.
  760.  *
  761.  * Return Codes
  762.  * paramErr
  763.  *
  764.  */
  765. EXTERN_API_C( OSStatus )
  766. ISpElement_GetNextEvent            (ISpElementReference     inElement,
  767.                                  UInt32                 bufSize,
  768.                                  ISpElementEventPtr     event,
  769.                                  Boolean *                wasEvent);
  770.  
  771. /*
  772.  *
  773.  * ISpElement_Flush
  774.  *
  775.  * It takes an ISpElementReference and flushes all the events on that element.  All it guaruntees is
  776.  * that any events that made it to this layer before the time of the flush call will be flushed and
  777.  * it will not flush any events that make it to this layer after the time when the call has returned.
  778.  * What happens to events that occur during the flush is undefined.
  779.  *
  780.  *
  781.  * Return Codes
  782.  * paramErr
  783.  *
  784.  */
  785. EXTERN_API_C( OSStatus )
  786. ISpElement_Flush                (ISpElementReference     inElement);
  787.  
  788.  
  789.  
  790. /*
  791.  * ISpElementList_New
  792.  *
  793.  * Creates a new element list and returns it in outElementList.  In count specifies 
  794.  * the number of element references in the list pointed to by inElements.  If inCount
  795.  * is non zero the list is created with inCount elements in at as specified by the 
  796.  * inElements parameter.  Otherwise the list is created empty.
  797.  *
  798.  *
  799.  * Return Codes
  800.  * out of memory - If it failed to allocate the list because it was out of memory
  801.                    it will also set outElementList to 0
  802.  * paramErr if outElementList was nil
  803.  *
  804.  *
  805.  * Special Concerns
  806.  *
  807.  * interrupt unsafe
  808.  *
  809.  */
  810. EXTERN_API_C( OSStatus )
  811. ISpElementList_New                (UInt32                 inCount,
  812.                                  ISpElementReference *    inElements,
  813.                                  ISpElementListReference * outElementList,
  814.                                  UInt32                 flags);
  815.  
  816. /*
  817.  * ISpElementList_Dispose
  818.  *
  819.  * Deletes an already existing memory list.  
  820.  *
  821.  *
  822.  * Return Codes
  823.  * paramErr if inElementList was 0
  824.  *
  825.  *
  826.  * Special Concerns
  827.  *
  828.  * interrupt unsafe
  829.  *
  830.  */
  831. EXTERN_API_C( OSStatus )
  832. ISpElementList_Dispose            (ISpElementListReference  inElementList);
  833.  
  834. /*
  835.  * ISpGetGlobalElementList
  836.  *
  837.  * returns the global element list
  838.  *
  839.  * Return Codes
  840.  * paramErr if outElementList is nil
  841.  *
  842.  */
  843. EXTERN_API_C( OSStatus )
  844. ISpGetGlobalElementList            (ISpElementListReference * outElementList);
  845.  
  846. /*
  847.  * ISpElementList_AddElement
  848.  *
  849.  * adds an element to the element list
  850.  *
  851.  * Return Codes
  852.  * paramErr if inElementList is 0 or newElement is 0
  853.  * memory error if the system is unable to allocate enough memory
  854.  *
  855.  * Special Concerns
  856.  * interrupt Unsafe
  857.  * 
  858.  */
  859. EXTERN_API_C( OSStatus )
  860. ISpElementList_AddElements        (ISpElementListReference  inElementList,
  861.                                  UInt32                 refCon,
  862.                                  UInt32                 count,
  863.                                  ISpElementReference *    newElements);
  864.  
  865. /*
  866.  * ISpElementList_RemoveElement
  867.  *
  868.  * removes the specified element from the element list
  869.  *
  870.  * Return Codes
  871.  * paramErr if inElementList is 0 or oldElement is 0
  872.  * memory error if the system is unable to allocate enough memory
  873.  *
  874.  * Special Concerns
  875.  * interrupt Unsafe
  876.  * 
  877.  */
  878. EXTERN_API_C( OSStatus )
  879. ISpElementList_RemoveElements    (ISpElementListReference  inElementList,
  880.                                  UInt32                 count,
  881.                                  ISpElementReference *    oldElement);
  882.  
  883. /*
  884.  * ISpElementList_Extract
  885.  *
  886.  * ISpElementList_Extract will extract as many of the elements from an element list as possible.  You pass
  887.  * in an element list, a pointer to an array of element references and the number of elements in that array.
  888.  * It will return how many items are in the element list in the outCount parameter and copy the minimum of 
  889.  * that number and the size of the array into the buffer.
  890.  *
  891.  * ByKind and ByLabel are the same except that they will only count and copy element references to elements
  892.  * that have the specified kind and label.
  893.  *
  894.  * Return Codes
  895.  * paramErr
  896.  *
  897.  */
  898. EXTERN_API_C( OSStatus )
  899. ISpElementList_Extract            (ISpElementListReference  inElementList,
  900.                                  UInt32                 inBufferCount,
  901.                                  UInt32 *                outCount,
  902.                                  ISpElementReference *    buffer);
  903.  
  904. EXTERN_API_C( OSStatus )
  905. ISpElementList_ExtractByKind    (ISpElementListReference  inElementList,
  906.                                  ISpElementKind         inKind,
  907.                                  UInt32                 inBufferCount,
  908.                                  UInt32 *                outCount,
  909.                                  ISpElementReference *    buffer);
  910.  
  911. EXTERN_API_C( OSStatus )
  912. ISpElementList_ExtractByLabel    (ISpElementListReference  inElementList,
  913.                                  ISpElementLabel         inLabel,
  914.                                  UInt32                 inBufferCount,
  915.                                  UInt32 *                outCount,
  916.                                  ISpElementReference *    buffer);
  917.  
  918. /*
  919.  * ISpElementList_GetNextEvent
  920.  *
  921.  * It takes in an element list reference and the buffer size of the ISpElementEventPtr
  922.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  923.  * was not enough space to fill in the whole event structure that event will be
  924.  * dequed, as much of the event as will fit in the buffer will by copied and
  925.  * ISpElementList_GetNextEvent will return an error.
  926.  *
  927.  * Return Codes
  928.  * paramErr
  929.  *
  930.  */
  931. EXTERN_API_C( OSStatus )
  932. ISpElementList_GetNextEvent        (ISpElementListReference  inElementList,
  933.                                  UInt32                 bufSize,
  934.                                  ISpElementEventPtr     event,
  935.                                  Boolean *                wasEvent);
  936.  
  937. /*
  938.  *
  939.  * ISpElementList_Flush
  940.  *
  941.  * It takes an ISpElementListReference and flushes all the events on that list.  All it guaruntees is
  942.  * that any events that made it to this layer before the time of the flush call will be flushed and
  943.  * it will not flush any events that make it to this layer after the time when the call has returned.
  944.  * What happens to events that occur during the flush is undefined.
  945.  *
  946.  *
  947.  * Return Codes
  948.  * paramErr
  949.  *
  950.  */
  951. EXTERN_API_C( OSStatus )
  952. ISpElementList_Flush            (ISpElementListReference  inElementList);
  953.  
  954. /*
  955.  *
  956.  * ISpTimeToMicroseconds
  957.  *
  958.  *
  959.  * This function takes time from an input sprocket event and converts it
  960.  * into microseconds. (Version 1.2 or later of InputSprocket.)
  961.  *
  962.  *
  963.  * Return Codes
  964.  * paramErr
  965.  *
  966.  */
  967. EXTERN_API_C( OSStatus )
  968. ISpTimeToMicroseconds            (const AbsoluteTime *    inTime,
  969.                                  UnsignedWide *            outMicroseconds);
  970.  
  971. #endif  /* TARGET_RT_MAC_CFM */
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978. #if PRAGMA_STRUCT_ALIGN
  979.     #pragma options align=reset
  980. #elif PRAGMA_STRUCT_PACKPUSH
  981.     #pragma pack(pop)
  982. #elif PRAGMA_STRUCT_PACK
  983.     #pragma pack()
  984. #endif
  985.  
  986. #ifdef PRAGMA_IMPORT_OFF
  987. #pragma import off
  988. #elif PRAGMA_IMPORT
  989. #pragma import reset
  990. #endif
  991.  
  992. #ifdef __cplusplus
  993. }
  994. #endif
  995.  
  996. #endif /* __INPUTSPROCKET__ */
  997.  
  998.